<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../layui-v2.6.8/layui/css/layui.css">
</head>
<body>
<div style="padding: 50px;">
    <div class="gdc-tx-photo" id="imgDragmove">
        <img id="img" src="" height="200" alt="图片名">
    </div>
</div>

<script src="../layui-v2.6.8/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-1.10.2/jquery-1.10.2.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">

    $.ajax({
        type: "GET",
        url: "/Camera/getImgPath",
        dataType: "json",
        success: function (data) {
            if (data.state == 0) {
                imgSrc = data.message.data;
                var obj = document.getElementById("img");
                obj.src = imgSrc;
                console.log(imgSrc)
            }
        }
    });

    layui.config({
        base: '../layui_exts/' //配置 layui 第三方扩展组件存放的基础目录
    }).extend({
        dragMove: 'dragMove/dragMove'
    }).use(['dragMove'], function () {
        var dragMove = layui.dragMove;

        //执行示例
        dragMove.render({
            elem: "#imgDragmove", //指向图片的父容器
            layerArea: ["640px", "480px"], //弹窗的宽高，同layer的area，默认["960px","720px"]
            layerShade: 0.6, //遮罩的透明度，同layer的shade，默认0.6
            layerMove: false, //触发拖动的元素，同layer的move，这里默认禁止，可设置为'.layui-layer-title'
            maxZoom: 1 //图片能放大的最大倍数，默认1倍
        });
    });


    setInterval(function () {
        $.ajax({
            type: "GET",
            url: "/Camera/getImgPath",
            dataType: "json",
            success: function (data) {
                if (data.state == 0) {
                    imgSrc = data.message.data;
                    var obj = document.getElementById("img");
                    obj.src = imgSrc;
                    console.log(imgSrc)
                }
            }
        });
    }, 20000)

</script>
</body>
</html>
